package org.tnaggs.project.manager;

import java.util.List;

import org.tnaggs.project.model.Contact;
import org.tnaggs.project.repository.ContactRepository;

public class ContactManager {

	private ContactRepository contactRepo;
	
	public ContactManager(ContactRepository contactRepo) {
		this.setContactRepo(contactRepo);
	}

	public ContactRepository getContactRepo() {
		return contactRepo;
	}

	public void setContactRepo(ContactRepository contactRepo) {
		this.contactRepo = contactRepo;
	}
	
	public List<Contact> getAllContacts() {
		return contactRepo.findAll();
	}

	public void createContact(Contact Contact) {
		contactRepo.insert(Contact);
	}
	
	public Contact getContact(int contactID) {
		return contactRepo.findByID(contactID);
	}

	public void changePassword(int contactID, String secondAttempt) {
		contactRepo.updatePassword(contactID, secondAttempt);
	}
	
	
	
	
}
